﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PresentationLayer
{
    class clsFormManager
    {
        #region Properties
        private frmMain MdiForm { get; set; }
        private frmConfiguration Configuration { get; set; }
        private frmLogin Login { get; set; }
        private frmStores Stores { get; set; }
        private frmUsers Users { get; set; }
        private frmFinances Finances { get; set; }
        private frmTranslation Translation { get; set; }
        private frmLanguages Languages { get; set; }
        private frmCurrency Currency { get; set; }
        
        #endregion

        #region Constructors
        public clsFormManager(frmMain pMdiForm)
        {
            this.MdiForm = pMdiForm;
        }
        #endregion

        #region Events
        #endregion

        #region Public methods
        /// <summary>
        /// Opens the currency window.
        /// </summary>
        public void ShowCurrency()
        {
            if (this.Currency == null || this.Currency.Visible == false)
            {
                Currency = new frmCurrency(this.MdiForm);
                Currency.MdiParent = this.MdiForm;
                Currency.StartPosition = FormStartPosition.CenterParent;
                Currency.Show();
            }
            else
            {
                Currency.Focus();
            }
        }
        /// <summary>
        /// Opens the languages window.
        /// </summary>
        public void ShowLanguages()
        {
            if (this.Languages == null || this.Languages.Visible == false)
            {
                Languages = new frmLanguages(this.MdiForm);
                Languages.MdiParent = this.MdiForm;
                Languages.StartPosition = FormStartPosition.CenterParent;
                Languages.Show();
            }
            else
            {
                Languages.Focus();
            }
        }

        /// <summary>
        /// Opens the translation window.
        /// </summary>
        public void ShowTranslation()
        {
            if (this.Translation == null || this.Translation.Visible == false)
            {
                Translation = new frmTranslation(this.MdiForm);
                Translation.MdiParent = this.MdiForm;
                Translation.StartPosition = FormStartPosition.CenterParent;
                Translation.Show();
            }
            else
            {
                Translation.Focus();
            }
        }

        /// <summary>
        /// Opens the configuration window.
        /// </summary>
        public void ShowConfiguration()
        {
            if (this.Configuration == null || this.Configuration.Visible == false)
            {
                Configuration = new frmConfiguration(this.MdiForm);
                Configuration.StartPosition = FormStartPosition.CenterParent;
                Configuration.ShowDialog();
            }
            else
            {
                Configuration.Focus();
            }
        }

        /// <summary>
        /// Opens the login window.
        /// </summary>
        public void ShowLogin()
        {
            if (this.Login == null || this.Login.Visible == false)
            {
                Login = new frmLogin(this.MdiForm);
                Login.StartPosition = FormStartPosition.CenterParent;
                Login.ShowDialog();
            }
            else
            {
                Login.Focus();
            }
        }

        /// <summary>
        /// Opens the users window.
        /// </summary>
        public void ShowUsers()
        {
            if (this.Users == null || this.Users.Visible == false)
            {
                Users = new frmUsers(this.MdiForm);
                Users.MdiParent = this.MdiForm;
                Users.StartPosition = FormStartPosition.CenterParent;
                Users.Show();
            }
            else
            {
                Users.Focus();
            }
        }

        /// <summary>
        /// Opens the stores window.
        /// </summary>
        public void ShowStores()
        {
            if (this.Stores == null || this.Stores.Visible == false)
            {
                Stores = new frmStores(this.MdiForm);
                Stores.MdiParent = this.MdiForm;
                Stores.StartPosition = FormStartPosition.CenterParent;
                Stores.Show();
            }
            else
            {
                Stores.Focus();
            }
        }

        /// <summary>
        /// Opens the expenses window.
        /// </summary>
        public void ShowFinances()
        {
            if (this.Finances == null || this.Finances.Visible == false)
            {
                Finances = new frmFinances(this.MdiForm);
                Finances.MdiParent = this.MdiForm;
                Finances.StartPosition = FormStartPosition.CenterParent;
                Finances.Show();
            }
            else
            {
                Finances.Focus();
            }
        }
        #endregion

        #region Private methods
        #endregion
    }
}
